/// <reference path="node_modules/@types/chrome/index.d.ts"/>
// import * as chrome from 'chrome';

let color = '#3aa757';

// 首次安装时触发
chrome.runtime.onInstalled.addListener(() => {
    chrome.storage.sync.set({ color });
    console.log('Default background color set to %cgreen', `color: ${color}`)

});

// 必须有接收终端
chrome.runtime.onConnect.addListener((devToolsConnection) => {
    // assign the listener function to a variable so we can remove it later
    // var devToolsListener = function (message: any, sender, sendResponse) {
    //     // Inject a content script into the identified tab
    //     chrome.scripting.executeScript(message.tabId, { file: message.scriptToInject });
    // }
    // // add the listener
    // devToolsConnection.onMessage.addListener(devToolsListener);

    // devToolsConnection.onDisconnect.addListener(function () {
    //     devToolsConnection.onMessage.removeListener(devToolsListener);
    // });
});